﻿using Prism.Events;
using Prism.Regions;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ZoneLineNew.Common;
using ZoneLineNew.Controls;
using ZoneLineNew.Services.Message;
using ZoneLineNew.Views;

namespace ZoneLineNew {
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow {

        public MainWindow(IRegionManager regionManager, IDialogService dialog, IMessageService messageBox, IEventAggregator eventAggregator) {
            InitializeComponent();
            NonClientAreaContent = new NonClientAreaControl();
            if (Cache.IsHopStaion) {
                MainTwoView.Visibility = Visibility.Visible;
                MainTwoView.IsSelected = true;
                MainView.Visibility = Visibility.Collapsed;
                MainView.IsSelected = false;
            } else if (Cache.IsQopStaion) {
                MainView.Visibility = Visibility.Visible;
                MainView.IsSelected = true;
                MainTwoView.Visibility = Visibility.Collapsed;
                MainTwoView.IsSelected = false;
            }
        }
      
        protected override void OnClosing(CancelEventArgs e) {
            base.OnClosing(e);
            var mbox = HandyControl.Controls.MessageBox.Ask("确定是否【关闭】【MES生产】系统软件？", "温馨提示");
            if (mbox != MessageBoxResult.OK) {
                e.Cancel = true;
            }
        }

    }
}
